package org.jeecg.common.system.base.entity;

import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;

/**
 * @author lixingxing
 */
@Data
public class AttributesValueParams {
    /**
     * 数据id
     */
    private String id;

    /**
     * 属性名列表
     */
    @NotNull(message = "属性名必填")
    private List property;

    /**
     * 属性值列表
     */
    @NotNull(message = "属性值必填")
    private List value;

    public AttributesValueParams() {
    }

    public AttributesValueParams(String id, String property, String value) {
        if (value == null) {
            value = "";
        }
        this.id = id;
        String[] properties = property.split(",");
        String[] values = value.split(",");
        this.property = Arrays.asList(properties);
        this.value = Arrays.asList(values);

    }

    public AttributesValueParams(String id, String[] property, String[] value) {
        this.id = id;
        this.property = Arrays.asList(property);
        this.value = Arrays.asList(value);
    }
}
